#ifndef TRANSFORMPREVIEW_H
#define TRANSFORMPREVIEW_H
#include "TransformState.h"
#include "TransformHelper.h"
#include "PixelHelper.h"
#include "AbstractAction.h"
#include "Work.h"



class TransformAction : public AbstractAction, TransformHelper, PixelHelper
{

  Q_OBJECT

private:

  Ptr< QImage > _pTransPart;
  Ptr< QImage > _pOtherPart;

  TransformState _transState;

  Ptr< SelectRegion > _pSelBackup;
  Ptr< SelectRegion > _pOrigSel;
  Ptr< SelectRegion > _pCurSel;



  QMatrix3x3 _getTransformMatrix ();

  QMatrix3x3 _getRTransformMatrix ();

public:

  TransformAction (Ptr< Work > pWork);
  ~TransformAction ();



  virtual void handleStartEvent ();

  virtual void updatePreview (QRect viewport);

  virtual void rejectAction ();

  virtual void applyAction ();




  void translate (QPoint v);

  void rotate (float angleR);

  void scale (QPointF val);



  TransformState & getTrans ();

  Ptr< SelectRegion > getOrigTransSel ();

  Ptr< SelectRegion > getCurTransSel ();


};

#endif // TRANSFORMPREVIEW_H
